<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jining Park</title>
    <link rel="stylesheet" type="text/css" href="../../styles/style_wiki.css" />
</head>

<body>
<div class="main_body" align="center">
    
<div class="wiki_title">
    <h2>命令行 subversion 配置</h2>

</div>

<div class="wiki_content">
	<h4>1、svn commit editor</h4>
    <p></p>
	<h4>2、svn diff editor</h4>
    <p class="subject1">1) 更换 svn diff 为 vimdiff</p>
    <p>将下面的代码存为 svn_diff 文件，放到 /usr/local/bin/ 目录下，并给执行权限</p>
    <p>然后修改 ~/.subversion/config 文件，将其中</p>
    <pre># diff-cmd = diff_program (diff, gdiff, etc.)</pre>
    <p>修改成</p>
    <pre>diff-cmd = /usr/local/bin/svn_diff</pre>
    <p class="subject1">2) 使用脚本作为 svndiff 命令</p>
    <p>将下面的代码存为 svndiff (没有.sh的后缀，这样方便直接使用 svndiff 执行)，放到 /usr/local/bin/下，并给执行权限即可</p>
    <pre>#!/bin/sh

# svndiff -- svn diff with vimdiff.

if [ $# -lt 1 ]; then
    echo "Usage: `basename $0` <file> [-r REV]"
    exit 0
fi

file_name=$1
pid=$$
TEMP_FILE=/tmp/tmp.$pid.${file_name##*/}
pv=

if [ $# -gt 3 -a "$2" == "-r" ]; then
    pv="-r $3"
fi

svn cat $file_name $pv > $TEMP_FILE
vimdiff $TEMP_FILE $file_name
rm -f $TEMP_FILE
</pre>
    
</div>

</div>
<!-- Content end -->

</div>
</body>
</html>
